Sender Rewriting Scheme
   HOME

TheInfoList



OR:

The Sender Rewriting Scheme (SRS) is a scheme for bypassing the
Sender Policy Framework Sender Policy Framework (SPF) is an email authentication method designed to detect forging sender addresses during the delivery of the email. SPF alone, though, is limited to detecting a forged sender claim in the envelope of the email, which is ...
's (SPF) methods of preventing forged sender addresses. Forging a sender address is also known as
email spoofing Email spoofing is the creation of email messages with a forged sender address. The term applies to email purporting to be from an address which is not actually the sender's; mail sent in reply to that address may bounce or be delivered to an unre ...
.


Background

In a number of cases, including change of email address and mailing lists, a
message transfer agent Within the Internet email system, a message transfer agent (MTA), or mail transfer agent, or mail relay is software that transfers electronic mail messages from one computer to another using SMTP. The terms mail server, mail exchanger, and MX host ...
(MTA) accepts an email message that is not destined to a local mailbox but needs to be forwarded. In such cases, the question arises of who deserves to receive any related
bounce message A bounce message or just "bounce" is an automated message from an email system, informing the sender of a previous message that the message has not been delivered (or some other delivery problem occurred). The original message is said to have "boun ...
. In general, that is either the author, or a person or other entity who administers the forwarding itself. Sending bounces to the author is administratively simpler and used to be accomplished by just keeping the original envelope sender. However, if the author address is subject to a strict SPF policy () and the target MTA happens to enforce it, the forwarding transaction can be rejected. As a workaround, it is possible to synthesize on the fly a temporary bounce address that will direct any bounce back to the current MTA. The scheme provides for recovering the original envelope address, so that if a bounce does arrive, it can be forwarded along the reverse path—with an empty envelope sender this time. While there are other workarounds, SRS is a fairly general one. Its notion of reversing the path resembles the original routing dispositions for email, see
below Below may refer to: *Earth *Ground (disambiguation) *Soil *Floor *Bottom (disambiguation) Bottom may refer to: Anatomy and sex * Bottom (BDSM), the partner in a BDSM who takes the passive, receiving, or obedient role, to that of the top or ...
. Please note : Using SRS protocol fails the SPF Alignment check for your DMARC record, and it's by design. Your DMARC record can still pass with a DKIM check.


The rewriting scheme

SRS is a form of
variable envelope return path Variable envelope return path (VERP) is a technique used by some electronic mailing list software to enable automatic detection and removal of undeliverable e-mail addresses. It works by using a different return path (also called "envelope sender" ...
(VERP) inasmuch as it encodes the original envelope sender in the local part of the rewritten address. Consider ' forwarding a message originally destined to to his new address : ORIGINAL : : REWRITTEN : : The example above is adapted from Shevek. With respect to VERP, the local part () is moved after her domain name (), further adding a prefix (), a hash ('), and a timestamp ('). That reflects an operational difference: Eventual bounces back to a
VERP Variable envelope return path (VERP) is a technique used by some electronic mailing list software to enable automatic detection and removal of undeliverable e-mail addresses. It works by using a different return path (also called "envelope sender" ...
address are handled within the rewriting domain, and forged messages can at most unsubscribe some users, a kind of abuse that hasn't seen significant exploits in the last decades. Instead, SRS aims at remailing a possible bounce back to ''Alice'', so that forged bounces can become an alluring technique for injecting spam apparently originating from the rewriting sender. * The local part, in this case , is moved because it may contain equal signs (=), so putting it at an extremity of the rewritten local part makes the latter parsable. * The timestamp (') has a one-day resolution in order to make the address invalid after a few days. Computed as , it can be stored as a two
base32 Base32 is the base-32 numeral system. It uses a set of 32 digits, each of which can be represented by 5 bits (25). One way to represent Base32 numbers in a human-readable way is by using a standard 32-character set, such as the twenty-two upper- ...
characters, with a recycling period of about 3.5 years. * The
hash-based message authentication code In cryptography, an HMAC (sometimes expanded as either keyed-hash message authentication code or hash-based message authentication code) is a specific type of message authentication code (MAC) involving a cryptographic hash function and a secre ...
(') is computed against a local secret, but only a part of it is used; for example, storing the first 4 characters of a
base64 In computer programming, Base64 is a group of binary-to-text encoding schemes that represent binary data (more specifically, a sequence of 8-bit bytes) in sequences of 24 bits that can be represented by four 6-bit Base64 digits. Common to all bina ...
representation provides 24
bits of security In cryptography, security level is a measure of the strength that a cryptographic primitive — such as a cipher or hash function — achieves. Security level is usually expressed as a number of "bits of security" (also security strengt ...
. The hash is checked by the domain who generated it, in case a bounce arrives. * The prefix, , is meant to disambiguate regular addresses from rewritten ones; it is up to ''example.com'' to ensure that none of its users has an email address starting with . SRS provides for another prefix, , to be used for rewriting an already rewritten address, in a multi-hop scenario. If ' has to forward the message in turn, it can spare adding another timestamp and repeating the original local part (). That is, each new forwarder adds just its own hash (') and the domain name of the preceding forwarder: FURTHER REWRITTEN : :


Database alternative

Using a database can definitely control the growth of rewritten addresses, since it is sufficient to put just a unique key in the rewritten local part. It also allows for a certain amount of anonymity in the resending process, if this is desired. However, a database requires centralization and is a single point of failure.


Header field alternative

Another possibility is to store the long rewritten address somewhere in the message header. The = tag of a DKIM-Signature may be a good place, as such choice considerably improves the security. This technique has been just observed. Unless there is a backup mechanism, it can only work if the bounce message is in a standard format.


Historical background

Historically all mail transfer agents (MTAs) added their host name to the '' reverse path''. In the
Simple Mail Transfer Protocol The Simple Mail Transfer Protocol (SMTP) is an Internet standard communication protocol for electronic mail transmission. Mail servers and other message transfer agents use SMTP to send and receive mail messages. User-level email clients typica ...
(SMTP) this ''reverse path'' is also known as , but paths were also used before and outside of SMTP, e.g. as ''
bang path UUCP is an acronym of Unix-to-Unix Copy. The term generally refers to a suite of computer programs and protocols allowing remote execution of commands and transfer of files, email and netnews between computers. A command named is one of the pro ...
s'' in
UUCP UUCP is an acronym of Unix-to-Unix Copy. The term generally refers to a suite of computer programs and protocols allowing remote execution of commands and transfer of files, email and netnews between computers. A command named is one of the prog ...
and
Usenet Usenet () is a worldwide distributed discussion system available on computers. It was developed from the general-purpose Unix-to-Unix Copy (UUCP) dial-up network architecture. Tom Truscott and Jim Ellis conceived the idea in 1979, and it was ...
(NetNews). All news articles still contain a header, example: : The same information in an RFC 5321 e-mail ''envelope'' - that is the SMTP info like - would be: # : # : The 1st step reflects the sender, the 2nd step the next MTA, etc. In this example let's assume that the 2nd MTA forwards the mail to a 3rd MTA, where it is finally delivered. The final MTA is also known as
Mail delivery agent A message delivery agent (MDA), or mail delivery agent, is a computer software component that is responsible for the delivery of e-mail messages to a local recipient's mailbox., ''Internet Mail Architecture'', D. Crocker (July 2009) It is also call ...
(MDA), putting the mail into the mailbox of the recipient. The MDA transforms the ''reverse path'' into the known header field: : SMTP uses
MX record A mail exchanger record (MX record) specifies the mail server responsible for accepting email messages on behalf of a domain name. It is a resource record in the Domain Name System (DNS). It is possible to configure several MX records, typically p ...
s for its forward routing. Explicit source routes as in... : ...to route mail from via MTA to MDA were cumbersome. To make things worse sometimes the ''new'' (1982) style of addresses was mixed with old UUCP ''bang paths'' in constructs like... ...and various other kludges. SMTP and MX records made all this essentially useless. Therefore, source routing was deprecated 1989 in RFC 1123. One special case in RFC 1123 are gateways from or to other networks like UUCP and NetNews, where the first sending MTA cannot reach the final receiver directly with TCP. It is solved by MX records and if necessary rewriting foreign addresses at the gateway. MX is an acronym for Mail eXchanger. Another special case are
mailing list A mailing list is a collection of names and addresses used by an individual or an organization to send material to multiple recipients. The term is often extended to include the people subscribed to such a list, so the group of subscribers is re ...
s, where the list server rewrites all ''reverse paths'' to its own error handling address for bounces (error messages) by recipients. The list server could automatically unsubscribe bouncing recipients. This type of address rewriting is known since RFC 821 and still used today (RFC 5321, as well as RFC 2821, updated the SMTP chapter in RFC 1123). Last but not least forwarding to another address always worked by rewriting the address in the ''forward path'' also known as , if and only if the forwarding MTA accepted the responsibility for both forwarding the mail and returning potential bounce messages to the sender. RFC 821 and all later SMTP specifications offer two result codes for this situation: * * For privacy reasons these result codes are today rarely used; they include the or . But the meaning and the effect of forwarding to third parties is identical for and respectively. As noted RFC 1123 deprecated source routing, that implicitly also deprecated the reverse routing of bounces. It was a relatively small Internet back in 1989, mail admins (postmasters) often knew each other and fixed problems on the fly. Routing bounce messages back via any forwarders was a waste of time and bandwidth if the MTA noting a problem (e.g. a rejection with a 5xx error code) could send the error message directly back to the MX of sender. Since RFC 1123 forwarders to third parties still rewrote the address, but kept the as is. As a side effect MTAs wishing to accept mail from forwarders generally accept any address. More than a decade later
spammers This is a list of individuals and organizations noteworthy for engaging in bulk electronic spamming, either on their own behalf or on behalf of others. It is not a list of all spammers, only those whose actions have attracted substantial independen ...
started to abuse this flaw in post-1123 SMTP, today most mails are
spam Spam may refer to: * Spam (food), a canned pork meat product * Spamming, unsolicited or undesired electronic messages ** Email spam, unsolicited, undesired, or illegal email messages ** Messaging spam, spam targeting users of instant messaging ( ...
and most ''reverse paths'' are forged. Note that
spammers This is a list of individuals and organizations noteworthy for engaging in bulk electronic spamming, either on their own behalf or on behalf of others. It is not a list of all spammers, only those whose actions have attracted substantial independen ...
typically forge working ''reverse paths'', many MTAs reject mail if
callback verification Callback verification, also known as callout verification or Sender Address Verification, is a technique used by SMTP software in order to validate e-mail addresses. The most common target of verification is the sender address from the message en ...
or other plausibility checks fail for the ''reverse path''. RFC 5321, as well as RFC 2821, states that non-delivery reports ( bounces) must be sent to the ''originator'' as ''indicated in the reverse path'' after an MTA accepted the responsibility for delivery. However, the bounce message may be suppressed when the original content is ''hostile'' (cf. spam or virus mail) or the message is forged (RFC 5321, Section 6). Note that all current forgery detection methods require the mailbox owner to supply information for them to work. Failing to supply the criteria should not make any bounce message classifiable as
backscatter In physics, backscatter (or backscattering) is the reflection of waves, particles, or signals back to the direction from which they came. It is usually a diffuse reflection due to scattering, as opposed to specular reflection as from a mirror, a ...
, although some people mistakenly think it should.
Open relay An open mail relay is a Simple Mail Transfer Protocol (SMTP) server configured in such a way that it allows anyone on the Internet to send e-mail through it, not just mail destined to or originating from known users. This used to be the default con ...
s and forwarders are in an unlucky position with regards to this issue, generally they can't guarantee that the address indicates the ''originator'', and they also can't guarantee that final delivery will succeed. This SMTP problem caused as side effect of RFC 1123 is addressed by SPF, and the executive summary is ''SPF breaks forwarding'' - actually that's not the case, only asks receivers to check SPF at their border MTA, not later. Receivers can arrange their forwarding in a way that works with SPF with in essence three strategies: # not checking SPF behind their border, e.g. ''white list'' forwarders # just reject , resulting in a bounce () # rewrite the at the forwarder (as done by mailing lists) Sender Rewriting Scheme (SRS) is one way for the third strategy.


See also

*
Sender Policy Framework Sender Policy Framework (SPF) is an email authentication method designed to detect forging sender addresses during the delivery of the email. SPF alone, though, is limited to detecting a forged sender claim in the envelope of the email, which is ...
(SPF) *
Bounce message A bounce message or just "bounce" is an automated message from an email system, informing the sender of a previous message that the message has not been delivered (or some other delivery problem occurred). The original message is said to have "boun ...
(SMTP non-delivery report) *
Bounce Address Tag Validation In computing, Bounce Address Tag Validation (BATV) is a method, defined in an Internet Draft, for determining whether the bounce address specified in an E-mail message is valid. It is designed to reject backscatter, that is, bounce messages to for ...
(BATV) *
Simple Mail Transfer Protocol The Simple Mail Transfer Protocol (SMTP) is an Internet standard communication protocol for electronic mail transmission. Mail servers and other message transfer agents use SMTP to send and receive mail messages. User-level email clients typica ...
(SMTP)


References

{{Reflist


External links


libsrs2 home page

Paper on SRS
(PDF)
Historical SRS draft
by Meng Weng Wong (2003)
qmail SRS patch

PostSRSd home page
(daemon that handles SRS for Postfix) Email authentication